<?php
/*
	TrixBi
	lightweight billing module for Trixbox
	Copyright(C) 2009 Denis "ddevil" Chunin
	GNU GPL v3
*/
require("cap.php");
require("classes/App.php");
$app = new App();
$app->Cap($var_cap_billing, $var_title);
$app->printMenu($var_main, $var_admin, $var_rates, $var_exit, TRUE); 
echo '<form action="record.php" method="POST" name="view_form">
	<table id="t_border">
		<tr valign="top">
			<td>
			<select name="tel" id="form" style="cursor : pointer;">
				<option selected value="#">-'.$var_subscriber_switch.'-</option>';
				$rooms = $app->myQuery("SELECT * FROM `users`", "asterisk", TRUE);
				foreach($rooms as $rooms)
					echo '<option value="'.$rooms['extension'].'">'.$rooms['name'].'</option>'."\n";
			echo '</td><td>
				<table>
					<tr>
						<td align="right">'.$var_from.':</td>
						<td><select name="sYear" />
							<option selected>'.$var_year.'</option>';
							for($i=0; $i<20; ++$i)
								echo '<option value="'.($i+2000).'">'.($i+2000).'</option>';
						echo '</select>';	
						echo '<select name="sMonth" />
							<option selected>'.$var_month.'</option>';
							for($i=0; $i<12; ++$i)
								echo '<option value="'.($i+1).'">'.($i+1).'</option>';
						echo '</select>';
						echo '<select name="sDay">';
							echo '<option selected />'.$var_day.'</option>';
							for($i=0; $i<31; ++$i)
								echo '<option value="'.($i+1).'">'.($i+1).'</optio>';
						echo '</select>';
						echo '<select name="sHour">';
							echo '<option selected>'.$var_hour.'</option>';
							for($i=0; $i<24; ++$i)
								echo '<option value="'.$i.'">'.$i.'</option>';
						echo '</select>';
						echo '<select name="sMinute">';
							echo '<option selected>'.$var_minute.'</option>';
							for($i=0; $i<60; ++$i)
								echo '<option value="'.$i.'">'.$i.'</option>';
						echo '</select></td>
					</tr>';
					echo '<tr>
						<td align="right">'.$var_to.':</td>
					</tr>
					<tr>
						<td><input type="radio" onclick="document.view_form.fYear.disabled=true; document.view_form.fYear.backgroundColor=\'grey\'; document.view_form.fMonth.disabled=true; document.view_form.fMonth.backgroundColor=\'grey\'; document.view_form.fDay.disabled=true; document.view_form.fDay.backgroundColor=\'grey\'; document.view_form.fHour.disabled=true; document.view_form.fHour.backgroundColor=\'grey\'; document.view_form.fMinute.disabled=true; document.view_form.fMinute.backgroundColor=\'grey\';" name="setDate" value=0/></td><td>'.date("Y-m-d H:i").'</td>
					</tr>
					<tr>
						<td><input type="radio" onclick="document.view_form.fYear.disabled=false; document.view_form.fYear.backgroundColor=\'grey\'; document.view_form.fMonth.disabled=false; document.view_form.fMonth.backgroundColor=\'grey\'; document.view_form.fDay.disabled=false; document.view_form.fDay.backgroundColor=\'grey\'; document.view_form.fHour.disabled=false; document.view_form.fHour.backgroundColor=\'grey\'; document.view_form.fMinute.disabled=false; document.view_form.fMinute.backgroundColor=\'grey\';" name="setDate" value=1/></td>';
						echo '<td><select name="fYear">';
							echo '<option selected>'.$var_year.'</option>';
							for($i=0; $i<20; ++$i)
								echo '<option name="'.($i+2000).'">'.($i+2000).'</option>';
						echo '</select>';
						echo '<select name="fMonth">';
							echo '<option selected>'.$var_month.'</option>';
							for($i=0; $i<12; ++$i)
								echo '<option value="'.($i+1).'">'.($i+1).'</option>';
						echo '</select>';
						echo '<select name="fDay">';
							echo '<option selected>'.$var_day.'</option>';
							for($i=0; $i<31; ++$i)	
								echo '<option value="'.($i+1).'">'.($i+1).'</option>';
						echo '</select>';
						echo '<select name="fHour">';
							echo '<option selected>'.$var_hour.'</option>';
							for($i=0; $i<24; ++$i)
								echo '<option value="'.$i.'">'.$i.'</option>';
						echo '</select>';
						echo '<select name="fMinute">';
							echo '<option selected>'.$var_minute.'</option>';
							for($i=0; $i<60; ++$i)
								echo '<option value="'.$i.'">'.$i.'</option>';
						echo '</select>';
						echo '</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr align="right">
			<td>
				<input type="reset" value="'.$var_clear.'">
			</td>
			<td>
				<input type="submit" value="'.$var_show.'" name="show">
			</td>
		</tr>
  	</table>
	</form>';
echo '</body></html>';
unset($app);
?>
